package cn.ai.boot.config.PCF;

import java.util.List;

public class DaSdkCondition {
    private DaSdkQuery query;
    private String key;
    private String operator;
    private String keyFun;
    private Object value;
    private List<DaSdkCondition> andList;
    private List<DaSdkCondition> orList;

    public DaSdkCondition() {
    }

    public DaSdkCondition(String key, String operator, Object value) {
        this.key = key;
        this.operator = operator;
        this.value = value;
    }

    public static DaSdkCondition create(String key) {
        return create(key, (Object)null);
    }

    public static DaSdkCondition create(String key, Object value) {
        DaSdkCondition condition = new DaSdkCondition();
        condition.setKey(key);
        condition.setOperator("eq");
        condition.setValue(value);
        return condition;
    }

    public static <T> DaSdkCondition in(String key, List<T> list) {
        return create(key).in(list);
    }

    public <T> DaSdkCondition in(List<T> list) {
        return this.operate("in", list);
    }

    public DaSdkCondition operate(String operate, Object value) {
        this.setOperator(operate);
        this.setValue(value);
        return this;
    }

    public static DaSdkCondition eq(String key, Object value) {
        return create(key).eq(value);
    }

    public DaSdkCondition eq(Object value) {
        return this.operate("eq", value);
    }

    public DaSdkCondition neq(Object value) {
        return this.operate("neq", value);
    }

    public DaSdkCondition like(Object value) {
        return this.operate("like", value);
    }

    public DaSdkQuery getQuery() {
        return this.query;
    }

    public void setQuery(DaSdkQuery query) {
        this.query = query;
    }

    public String getKey() {
        return this.key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getOperator() {
        return this.operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public String getKeyFun() {
        return this.keyFun;
    }

    public void setKeyFun(String keyFun) {
        this.keyFun = keyFun;
    }

    public Object getValue() {
        return this.value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public List<DaSdkCondition> getAndList() {
        return this.andList;
    }

    public void setAndList(List<DaSdkCondition> andList) {
        this.andList = andList;
    }

    public List<DaSdkCondition> getOrList() {
        return this.orList;
    }

    public void setOrList(List<DaSdkCondition> orList) {
        this.orList = orList;
    }
}
